using Mono.Cecil;

namespace LoggingMagic.Injectors.Helpers
{
    /// <summary>
    /// provides references to some common types
    /// </summary>
    internal class TypeReferencesProvider
    {
        private readonly ModuleDefinition _module;

        public TypeReferencesProvider(ModuleDefinition module)
        {
            _module = module;
        }

        public TypeReference Object
        {
            get { return _module.TypeSystem.Object; }
        }

        private TypeReference _systemObjectArrayRef;
        public TypeReference ArrayOfObjects
        {
            get
            {
                if (_systemObjectArrayRef == null)
                {
                    _systemObjectArrayRef = _module.Import(new ArrayType(Object));
                }
                return _systemObjectArrayRef;
            }
        }
    }
}